<template>
	<view>
		<!-- 核销码输入框 -->
		<view class="code_input">
			<text style="color: #2979ff;">输入核销码：</text>
			<view class="input_inner">
				<uni-easyinput :inputBorder="false"></uni-easyinput>
				<view class="identify" @click="identify">识别</view>
			</view>
		</view>

		<!-- 核销信息 -->
		<view v-show="openverdg">
			<view class="ver_info">
				<uni-card style="margin: 50rpx 0;">
					<view class="title">核销码&nbsp;{{order.verificationCode}}</view>
					<view class="content">
						<view class="item">服务内容</view>
						<view>{{order.content}}</view>
					</view>

					<!-- 订单信息 -->
					<view class="order">
						<view class="item">订单信息</view>
						<list-view v-model="order.orderInfo">
							<view>订单价格：￥{{order.orderInfo.originPrice}}</view>
							<view>实付金额：￥{{order.orderInfo.newPrice}}</view>
							<view>优惠金额：￥{{order.orderInfo.purchasePrice}}</view>
							<view>订单编号：{{order.orderInfo.id}}</view>
							<view>支付日期：{{order.orderInfo.payDate}}</view>
							<view>预约时间：{{order.orderInfo.reservationTime}}</view>
						</list-view>
					</view>
				</uni-card>
			</view>
			<!-- 确认核销 -->
			<view class="subbmit" @click="dialog" :style="{backgroundColor: bgcolor}">{{var_status}}</view>
		</view>

		<view class="dialog" v-show="opendg">
			<uni-card>
				<view class="dg_title">核销此订单</view>
				<view style="text-align: center;">请您仔细核对订单，此操作不可撤销请谨慎操作!</view>
				<view class="bt">
					<view class="bt" @click="subbmit(1)">取消</view>
					<view class="bt" @click="subbmit(2)">确定</view>
				</view>
			</uni-card>
		</view>
		<!-- 遮罩层 -->
		<view class="mask" v-show="opendg">
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//核销码
				verificationCode: 'MC-1234-5678-9012',
				order: {
					verificationCode: 'MC-1234-5678-9012',
					content: 'XXX标准洗车服务包含整车泡沫冲洗擦干轮胎轮毂冲洗清洁车内吸尘内饰脚垫简单除尘(不包含虫尸、水泥、沥青和顽固污渍清理等)',
					orderInfo: {
						originPrice: 90
					}
				},
				openverdg: false,
				opendg: false,
				var_status: '确认核销',
				bgcolor: '#2979ff'
			}
		},
		methods: {
			dialog() {
				this.opendg = true;
			},
			identify() {
				this.openverdg = true;
			},
			subbmit(e) {
				this.opendg = false;
				if (e === 2) {
					this.var_status = '已核销';
					this.bgcolor = '#6a6a6a';
					console.log("确认核销");
				} else {
					console.log("取消核销");
				}
			},
			dystatus() {
				backgroundColor: this.bgcolor;
			}

		}
	}
</script>

<style>
	page {
		padding: 0 30rpx;
		background-color: #ffffff;
	}

	/* 核销码输入框 */
	.code_input {
		margin-top: 30rpx;
		font-size: 28rpx;
	}

	.uni-easyinput {
		display: inline-block;
		width: 50vw;
	}

	.input_inner {
		display: inline-block;
		height: 74rpx;
		border: 1rpx solid #e9e9eb;
		border-top-right-radius: 50rpx;
		border-bottom-right-radius: 50rpx;
	}

	.identify {
		display: inline-block;
		background-color: #2979ff;
		color: white;
		width: 120rpx;
		height: 70rpx;
		line-height: 72rpx;
		text-align: center;
		font-size: 14rpx;
		margin-left: 20rpx;
		border-radius: 50rpx;
	}

	/* 核销信息 */
	.ver_info .uni-card {
		width: 92vw;
		height: 60vh;
		border-radius: 30rpx;
	}

	.title {
		text-align: center;
		font-size: 32rpx;
		font-weight: bold;
		color: black;
		padding-bottom: 20rpx;
		margin-bottom: 20rpx;
		border-bottom: 1rpx solid #e9e9eb;
	}

	.content {

		font-weight: bold;
		padding-bottom: 20rpx;
		margin-bottom: 20rpx;
		border-bottom: 1rpx solid #e9e9eb;
	}

	.content view:nth-child(2) {
		overflow: auto;
		height: 200rpx;
	}

	/* 订单信息 */
	.item {
		font-size: 32rpx;
		font-weight: bold;
	}

	.order view {
		padding: 5rpx 0;
	}

	.subbmit {
		/* background-color: #2979ff; */
		color: #ffffff;
		border-radius: 30rpx;
		border: none;
		width: 70vw;
		height: 5vh;
		text-align: center;
		line-height: 5vh;
		margin: auto;
	}

	/* 对话框 */
	.dialog {
		z-index: 12;
		width: 92vw;
		position: absolute;
		top: 20vh;
	}

	.dialog .uni-card {
		border-radius: 20rpx;
		height: 300rpx;
	}

	.dialog .dg_title {
		text-align: center;
		font-size: 32rpx;
		font-weight: bold;
		margin-bottom: 20rpx;
	}

	.dialog .bt {
		display: flex;
		justify-content: space-around;
	}

	.dialog .bt view {
		background-color: #2979ff;
		color: #ffffff;
		width: 150rpx;
		height: 60rpx;
		display: inline-block;
		text-align: center;
		line-height: 60rpx;
		border-radius: 30rpx;
	}

	.mask {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		/* 半透明背景 */
		z-index: 10;
		/* 确保遮罩层在内容之上 */
	}
</style>